import { uniqueId } from 'lodash'

/**
 * @description 给菜单数据补充上 path 字段
 * @description https://github.com/d2-projects/d2-admin/issues/209
 * @param {Array} menu 原始的菜单数据
 */
function supplementPath (menu) {
  return menu.map(e => ({
    ...e,
    path: e.path || uniqueId('d2-menu-empty-'),
    ...e.children ? {
      children: supplementPath(e.children)
    } : {}
  }))
}

function getMenu () {
  return [
    { path: '/index', title: '实时监控', icon: 'home' },
    { path: '/tag', title: '数据管理', icon: 'tag' },
    //,
    // { path: '/template', title: '表情模板管理', icon: 'meh-o' },
    // { path: '/bgm', title: '背景音乐管理', icon: 'music' },
    // { path: '/file', title: '文件管理', icon: 'file-code-o' },
    // { path: '/article', title: '文章管理', icon: 'book' },
    // { path: '/settings', title: '配置管理', icon: 'sliders' },
    // { path: '/utilpage', title: '工具页', icon: 'wrench' }
  ]
}

export const menuHeader = supplementPath(getMenu())

export const menuAside = supplementPath(getMenu())
